package com.example.common.entity;

import java.math.BigInteger;
import java.util.Objects;
import java.io.Serializable;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.Data;

/*
 * id for sys_roles_menus
 */
@Embeddable
@Data
public class SysRolesMenusId implements Serializable {
    @Column(name = "role_id")
    private BigInteger roleId;
    @Column(name = "menu_id")
    private BigInteger menuId;
    
    public SysRolesMenusId() {}
    
    public SysRolesMenusId(BigInteger roleId, BigInteger menuId) {
        this.roleId = roleId;
        this.menuId = menuId;
    }
    
    public void setRoleId(BigInteger roleId) {
        this.roleId = roleId;
    }
    
    public void setMenuId(BigInteger menuId) {
        this.menuId = menuId;
    }
    
    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        SysRolesMenusId that = (SysRolesMenusId) o;
        return Objects.equals(roleId, that.roleId) && Objects.equals(menuId, that.menuId);
    }
    
    @Override
    public int hashCode() {
        return Objects.hash(roleId, menuId);
    }
}
